﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace Inference
{
    public partial class FormResult : Form
    {
        public FormResult()
        {
            InitializeComponent();
        }
        SqlDataAdapter adapter; SqlCommand command; DataTable table;
        public string ConnectionString;

        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listBox1.SelectedIndex > -1)
            {
                string select="";
                switch (listBox1.SelectedIndex)
                {
                    case (0): { select="Select * from  ViewValues"; break; }
                    case (1): { select = "Select * from ViewLog "; break; }
                };
                command.CommandText = select;
                dataGridView1.Columns.Clear();
                table.Reset();
                adapter.Fill(table);
                dataGridView1.Refresh();
                dataGridView1.SelectAll();
            }
        }

        private void ViewNBD_Load(object sender, EventArgs e)
        {
            command = new SqlCommand("",new SqlConnection(ConnectionString));
            adapter = new SqlDataAdapter(command);
            table = new DataTable();
            dataGridView1.DataSource = table;
        }
    }
}
